Listers, Sent this out on 8/17, but haven't seen it yet, so I'll try again. Before I go to the kudo's, though, I've got another request for help: I have a table with a certain set of fields for which I have already set the aliases in the code. Now I want to make sure that the fields are always in a certain order. I.E., if the input order of the fields is Application Code, PID, Designation (or any other arrangement) I want to arrange the fields so that the output order is always Designation, PID, Application Code. Is there a way of doing this without copying to a new table? Thanks so much to Listers for such a quick response to my question about my faulty script for flagging dups. The original query was: "I'm stuck, and I'm willing to bet it's something obvious that everybody but me can see. To add to the aggravation, I'd swear that I had this script working at one point. I have a script in which a field called "ID" is created and populated. When that's done, I want to flag any duplicates that are in that field so that I can change them later. The piece of script that I have and that I would swear once worked is as follows: theFields = theFTab.GetFields id = theFTab.FindField("ID") if (id = nil) then MsgBox.Error("Can't find ID field!","Oops!") exit end 'Loops through the table, checking for unique values and flagging duplicates for each rec1 in theFTab val1 = theFTab.ReturnValue(id,rec1) for each rec2 in theFTab if ((theFTab.ReturnValue(id,rec2) = val1) AND (rec1 <> rec2)) then MsgBox.Info(val1++"is a duplicate","Found dup!") end end end Can anyone tell me why it isn't working and/or suggest an alternative?" I received suggestions from: Hans van Dorp, who stated that the code worked fine when he used it. (I knew it worked once upon a time!), and suggested using ReturnValueString Kevin Bell, who pointed me to the scripts page Jorge Avila, who sent along bu_pfd.ave Bill Huber, who pointed me to table_queryunique.ave, which I missed when I searched originally John Garcia, who sent along compiled_table_tools.avx Chris Bertinato, who suggested rewriting the loops as: for each rec1 in 0..(theFTab.GetNumRecords-1) Bob Davis, suggested using Access Bob Hallett, who sent a script to run from a GUI button Dr. Uwe Lange, with a suggestion to make sure of the field definition Dennis Roose, with a suggestion about the FTab handle and, finally, Paul Jendrowski, who sent me a piece of script that incorportated perfectly with what I wanted to do in my script: ' Check if vtab is passed as argument or is from active table if (self = nil) then theTable = av.GetActiveDoc theVTab = theTable.GetVTab else theVTab = self end size = theVtab.getNumRecords oldRec = theTable.ConvertRowToRecord(0) pFld = theVtab.FindField("Basin_id") oldVal= theVtab.ReturnValue(pFld,oldRec) 'msgbox.info(oldVal.Asstring,"") theBitmap = theVTab.GetSelection for each i in 1..(size - 1) rec=theTable.ConvertRowToRecord(i) theVal=theVtab.ReturnValue(pFld,rec) if (theVal = oldVal) then theBitmap.set(oldRec) theBitmap.set(rec) end oldVal = theVal oldrec = rec end theVtab.updateSelection I incorporated code that sorts the appropriate field, goes through the selection process, then pops the table open and makes it editable. If I've missed anyone, my apologies. Thanks again for all the help! -- Cindy Craig National Geodetic Survey Project Development Branch Spatial Reference System Division 1315 East-West Highway, SSMC3-8708 Silver Spring, MD 20910-3282 Phone: 301-713-3194, ext. 106